package com.chen.longchain4jdemo.controller;

import com.chen.longchain4jdemo.aiservice.ConsultantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RestController
public class ChatController {

    @Autowired
    private ConsultantService consultantService;

    @RequestMapping(value = "/chat", produces = "text/html;charset=utf-8")
    public Flux<String> streamChat(String memoryId, String message) {
        return consultantService.chat(memoryId, message);
    }

    @GetMapping("/test")
    public String test() {
        return "test";
    }
}
